import requests


class HttpRequest:
    @staticmethod
    def get(url, params=None, headers=None):
        try:
            response = requests.get(url, params=params, headers=headers)
            response.raise_for_status()
            return response.json()
        except Exception as e:
            print(f"请求失败：{e}")
            raise

    @staticmethod
    def post(url, data=None, json=None, headers=None):
        try:

            response = requests.post(url, data=data, json=json, headers=headers)
            response.raise_for_status()
            return response.json()
        except Exception as e:
            print(f"请求失败：{e}")
            raise
